/**
* 版权声明：厦门睿商网络科技有限公司 版权所有 违者必究
* 日    期：2020-08-06
*/
package com.rzico.order.entity;

import com.rzico.annotation.IgnoreSwaggerParameter;
import com.rzico.basics.entity.Member;
import lombok.Data;
import java.util.Date;
import javax.persistence.*;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

/**
 * <pre>
 *   礼品卡数据库对象
 * </pre>
 * @author Rzico Boot
 * @version 1.0
 */
@Data
@JsonIgnoreProperties(value = {"handler"})
@JsonInclude(JsonInclude.Include.NON_NULL)
@Table(name = "wx_gift_card")
public class GiftCard{
    @Id
    @ApiModelProperty(value = "" )
    protected Long id;

    @ApiModelProperty(value = "创建日期" )
    protected java.util.Date createDate;

    @ApiModelProperty(value = "修改日期" )
    protected java.util.Date modifyDate;

    @ApiModelProperty(value = "订单来源" )
    protected Long orderId;

    @ApiModelProperty(value = "套餐商品" )
    protected Long productId;

    @ApiModelProperty(value = "礼卡商品名" )
    protected String name;

    @ApiModelProperty(value = "礼卡商品缩例图" )
    protected String thumbnail;

    @ApiModelProperty(value = "类型（0.套餐，1.礼单）" )
    protected Integer type;

    @ApiModelProperty(value = "类型（0.待领取，1.待使用，2.已使用）" )
    protected Integer status;

    @ApiModelProperty(value = "创建人" )
    protected Long memberId;

    @ApiModelProperty(value = "接收人" )
    protected Long receiverId;

    @ApiModelProperty(value = "企业" )
    protected Long enterpriseId;


    @ApiModelProperty(value = "商品价格")
    protected java.math.BigDecimal price;

    /**
     *  赠送人
     */
    @JsonIgnore
    @IgnoreSwaggerParameter
    protected Member member;


    /**
     *  接收人
     */
    @JsonIgnore
    @IgnoreSwaggerParameter
    protected Member receiver;

    public String getMemberName() {
        Member member = getMember();
        if (member!=null) {
            return member.getName();
        } else {
            return null;
        }
    }

    public String getReceiverName() {
        Member receiver = getReceiver();
        if (receiver!=null) {
            return receiver.getName();
        } else {
            return null;
        }
    }


}
